home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 68.7z / BS1 part 68 / Scala Infochannel IC402 v4.03 (1993)(Scala AS)(Disk 1 of 3)(NTSC)[HD][cr SR].7z / Scala Infochannel IC402 v4.03 (1993)(Scala AS)(Disk 1 of 3)(NTSC)[HD][cr SR].adf / ARexx.lha / Arexx / Dir.scala
Text File  |  1993-01-22  |  3KB  |  106 lines

  1. /**********************************************************************
  2. * This ARexx program demonstrates how to communicate with other
  3. * applications (in this case AmigaDOS!) and bring the results 
  4. * back to Scala using Scala Lingo.
  5. *   
  6. * The program displays a list of all files in the current
  7. * directory,
  8. *   
  9. * You may also specify a directory name:
  10. *   
  11. *    1> rx Dir:scala Work:Scala/Backgrounds
  12. *
  13. * Depending on your harddisk setup, you might have to change the
  14. * assignment of "picture_file = ..." below.
  15. **********************************************************************/
  16.  
  17. /* trace results */
  18.  
  19. parse arg dir
  20.  
  21. picture_file = ":Scala/Backgrounds/Texture002"  /* Background picture     */
  22.  
  23. tmpfile1 = "ram:scdir1.tmp"        /* Temporary file #1         */
  24. tmpfile2 = "ram:scdir2.tmp"        /* Temporary file #2         */
  25.  
  26. pagenum    = 0
  27.  
  28. prepare_page()          /* Set up a new page, but don't display yet...     */
  29.  
  30.  
  31. address command                /* Talk to DOS             */
  32. /* Use AmigaDOS "LIST" to obtain a list of files.  The list is placed
  33.    in a temporary file in RAM */
  34. 'list >' tmpfile1 ' ' dir ' quick nohead'
  35. 'sort' tmpfile1 tmpfile2
  36.  
  37. /* Read and display all filenames in the list */
  38. if open(file,tmpfile2,'Read') then do
  39.     do while ~eof(file)
  40.     name = readln(file)        /* Get next filename        */
  41.     address 'rexx_InfoChannel'        /* Talk to ScalaPlayer        */
  42.     if length(name) > 0 then
  43.         text x y '"'||name||'"'      /* Write text            */
  44.     y = y + 20
  45.     if y > 380 then do
  46.         y = 80
  47.         x = x + 210
  48.         if x = 230 then do
  49.                 textwipe bob south easeout speed 10
  50.         end
  51.         if x = 440 then do
  52.                 textwipe bob west easeout speed 10
  53.         end
  54.         if x >= 630 then do        /* Filled up a page?        */
  55.             show            /* Yes: display the page    */
  56.             prepare_page()        /* Set up the next page     */
  57.         end
  58.     end
  59.     end
  60.     close(file)
  61.     /* Delete the temporary file from RAM: */
  62.     address command
  63.     'delete ' tmpfile1 tmpfile2
  64. end
  65.  
  66. /* All filenames are processed; we have set up a page wich is now
  67.    ready to be displayed */
  68. address 'rexx_InfoChannel'            /* Talk to ScalaPlayer again... */
  69. show                    /* Show the page!        */
  70. continue
  71. exit                    /* and exit!            */
  72.  
  73.  
  74. /*
  75. * Subroutine:
  76. * Set up a new page with background picture, heading, page number.
  77. * The page is not displayed until a "SHOW" command is issued.
  78. */
  79. prepare_page:
  80.     pagenum = pagenum + 1
  81.     address 'rexx_InfoChannel'        /* Talk to ScalaPlayer         */
  82.     picture picture_file        /* Use background IFF picture     */
  83.     wipe curtain speed 10
  84.     font "franklin.font" 23        /* Select font             */
  85.     color 9 0 0 0 0 0 0            /* Set text colors         */
  86.     style 0 3 4 3 6 2 1 29 4 1 20 0 5 2    /* Set text style parameters     */
  87.     attributes underline shadow    /* Draw text with underline and shadow     */
  88.     /* Display heading */
  89.     textwipe dump
  90.     text 20 40 '"Directory:                                                                                               "'
  91.     if length(dir) > 0 then 
  92.         text 160 40 dir
  93.     else
  94.         text 160 40 '"(Current Directory)"'
  95.     text 530 40 '"' || '(Page' pagenum || ')"'
  96.     font "franklin.font" 18
  97.     style 0 3 4 3 6 2 1 14 2 1 20 0 5 2
  98.     color 1 0 0 0 0 0 0
  99.     'pause -1'                /* Show page until mouse click    */
  100.     /* Turn off underline but keep shadow */
  101.     attributes shadow
  102.     x = 20
  103.     y = 80
  104.     textwipe bob east easeout speed 10
  105. return 1
  106.